Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers/ft5x06: fix vendor ID for FT6xx6 and FTxxxx register addresses #19860

Merged
merged 2 commits into from
Aug 23, 2023

Conversation

gschorcht
Copy link
Contributor

@gschorcht gschorcht commented Aug 6, 2023

Contribution description

This PR provides a fix of the vendor ID for FT6xx6 touch panel driver ICs and a fix of register addresses for FTxxxx.

According to the Application Note for FT6x06 CTPM, the vendor ID of FT6x06 touch panel driver ICs is 0x11 instead of 0xcd. Although there are no information found in the Web about the FT6x36, the FT6336U touch panel of a ESP32-S3 WT32 SC01 Plus is also working with 0x11 as vendor ID so that it seems that FT6x36 is also using 0x11 as vendor ID.

Figured out with a stm32f723e-disco board (revision D03). Without this PR, tests/drivers/ft5x06 gives:

+------------Initializing------------+
[ft5x06] init: invalid vendor ID: '0x11' (expected: 0xcd)
[Error] Initialization failed

With this PR it works as expected.

+------------Initializing------------+
Initialization successful
main(): This is RIOT! (Version: 2023.10-devel-96-gbb9011-drivers/ft5x06_fix_vendor_id)
FT5x06 test application

+------------Initializing------------+
[ft5x06] init: configuring touchscreen interrupt
Initialization successful
1 touch detected
[ft5x06] read gesture_id '0x00'
Touch 1 - X: 151, Y:138
[ft5x06] read gesture_id '0x00'

Some background information found in the Web:

  • According to the STM32CubeF7 the FRIDA LCD panel mounted on the stm32f723e-disco board either uses FT6x36 (prior revision D) or FT3x67 (revision D). However, the FT5x06 driver type for the card is defined as FT6x06, which does not seem correct:
    #define FT5X06_PARAM_TYPE FT5X06_TYPE_FT6X06 /**< Device type */
  • According to the STM32CubeF7, the vendor ID for FT6x36 should be 0xcd. However, the FT6336U on ESP32-S3 WT32 SC01 Plus works with vendor ID 0x11.
  • The Adafruit FT6206 library uses 0x11 as vendor id.
  • The stm32l496g-disco board uses a FT6236 which has vendor ID 0xcd.

So the information available on the web is confusing. Maybe, a better solution would be to accept 0x11 as well as 0xcd as vendor ID for FT6xxx touch panels. Unfortunately, there are no documents available on the registers directly from FocalTech 😟 so it seems to be more speculation than knowledge.

Testing procedure

Issues/PRs references

The vendor ID of FT6xx6 touch panel driver ICs is `0x11` instead of `0xcd`.
@github-actions github-actions bot added the Area: drivers Area: Device drivers label Aug 6, 2023
@gschorcht gschorcht requested a review from aabadie August 6, 2023 15:50
@gschorcht gschorcht added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Aug 6, 2023
@riot-ci
Copy link

riot-ci commented Aug 6, 2023

Murdock results

✔️ PASSED

a9f3ce1 drivers/ft5x06: fix register addresses

Success Failures Total Runtime
7938 0 7939 13m:38s

Artifacts

@benpicco benpicco added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Aug 7, 2023
Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trusting your testing on this one.

@gschorcht gschorcht added the State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet label Aug 7, 2023
@gschorcht
Copy link
Contributor Author

I'm trusting your testing on this one.

Unfortunately, it is more complicated than it looked. There are indeed STM32 boards with FT6236 which uses 0xcd instead of 0x11 as vendor ID (I had to learn that my stm32l496-disco board is one of them) although all other driver libraries for FT6x36 use 0x11 such as the Adafruit library that is used for their LCD display with FT6236U.

I'm working on a solution that will work with both vendor IDs.

@gschorcht gschorcht added State: invalid State: The issue / PR is not valid and removed State: invalid State: The issue / PR is not valid State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet labels Aug 7, 2023
@gschorcht
Copy link
Contributor Author

gschorcht commented Aug 9, 2023

@benpicco Now it checks for both 0x11 as well as 0xcd as vendor ID for FT6xxx` models.

Furthermore, when trying to use gesture which don't work at all for FTxxxx, I found a bug in register addresses that is also fixed now with this PR.

@gschorcht gschorcht changed the title drivers/fx5x06: fix vendor ID for FT6xx6 drivers/fx5x06: fix vendor ID for FT6xx6 and FTxxxx register addresses Aug 9, 2023
@gschorcht gschorcht force-pushed the drivers/ft5x06_fix_vendor_id branch from 2d26165 to 766f0f4 Compare August 9, 2023 08:20
@gschorcht
Copy link
Contributor Author

@benpicco Does the ACK still apply?

@benpicco
Copy link
Contributor

Sure!

@gschorcht gschorcht force-pushed the drivers/ft5x06_fix_vendor_id branch from 766f0f4 to a9f3ce1 Compare August 14, 2023 22:06
@gschorcht
Copy link
Contributor Author

Sure!

I sqashed it.

@gschorcht gschorcht changed the title drivers/fx5x06: fix vendor ID for FT6xx6 and FTxxxx register addresses drivers/ft5x06: fix vendor ID for FT6xx6 and FTxxxx register addresses Aug 15, 2023
@benpicco
Copy link
Contributor

bors merge

@bors
Copy link
Contributor

bors bot commented Aug 23, 2023

👎 Rejected by PR status

@benpicco benpicco added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Aug 23, 2023
@gschorcht gschorcht added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Aug 23, 2023
@benpicco
Copy link
Contributor

bors merge

@bors
Copy link
Contributor

bors bot commented Aug 23, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot merged commit 2a4496b into RIOT-OS:master Aug 23, 2023
@gschorcht
Copy link
Contributor Author

Thanks

bors bot added a commit that referenced this pull request Aug 24, 2023
19866: drivers/ft5x06: use a pointer to config parameters instead of copying them r=benpicco a=gschorcht

### Contribution description

There is no need to copy the configuration parameter set to the device descriptor. A const pointer to the configuration parameter set in ROM is sufficient. It saves 16 byte of RAM.

Includes PR #19860 for the moment to be compilable.

### Testing procedure

Use 
```
CFLAGS='-DNDEBUG' BOARD=stm32f723e-disco make -j8 -C tests/drivers/touch_dev/
```
with and w/o this PR and compare the sizes.

Without the PR the sizes are:
```
  text	   data	    bss	    dec
  14652	    136	   2704	  17492
```
With the PR the sizes are:
```
  text	   data	    bss	    dec
  14676	    136	   2688	  17500
```

### Issues/PRs references

~Depends on PR #19860~


Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
bors bot added a commit that referenced this pull request Aug 27, 2023
19867: drivers/ft5x06: introduce conversion for X and Y coordinates r=aabadie a=gschorcht

### Contribution description

This PR provides the parameter option to define how the X and Y coordinates have to be converted.

To get coordinates from the touch panel that correspond to the display coordinates, it is often necessary to convert the coordinates from the touch pannel by swapping and mirroring them. For the sake of simplicity, possible rotations are additionally defined.

The PR includes PRs #19860 and #19866 to be compilable.

### Testing procedure

`tests/pkg/lvgl_touch` should still work for the `stm32f746g-disco` board.
```
BOARD=stm32f746g-disco make -C tests/pkg/lvgl_touch
```

### Issues/PRs references

~Depends on PR #19860~
Depends on PR #19866 

Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
@gschorcht gschorcht deleted the drivers/ft5x06_fix_vendor_id branch August 30, 2023 16:47
@MrKevinWeiss MrKevinWeiss added this to the Release 2023.10 milestone Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: drivers Area: Device drivers CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants